package com.atqh.logistics.controller.LoginController;

import com.atqh.logistics.Aop.LogAnnotation;
import com.atqh.logistics.service.CustomService;
import com.atqh.logistics.utils.Result;
import com.atqh.logistics.utils.Vo.params.LoginParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @作者：大叔azhe
 * @api：详细描述
 * @创建时间：15:22 2023/4/11
 */
@Api(tags = "客户登录注销功能模块")
@RestController
@CrossOrigin
@RequestMapping("/custom")
public class CustomLoginController {

    @Autowired
    private CustomService customService;

    @ApiOperation("客户登录")
    @RequestMapping("/customlogin")
    @LogAnnotation(module = "客户模块", operator = "客户登录")
    public Result login(@RequestBody LoginParam loginParam,HttpServletRequest req) {

        return customService.login(loginParam.getAccount(), loginParam.getPassword(),req);

    }

    @ApiOperation("客户注销")
    @RequestMapping("/customlogout")
    @LogAnnotation(module = "客户模块", operator = "客户注销")
    public Result logout(HttpServletRequest req) {
        return customService.logout(req);
    }


}
